VCS = vcs
VCS_FLAGS = -full64 -sverilog +v2k -timescale=1ns/1ps \
            -debug_acc+all -kdb -lca \
            +define+UVM_NO_DEPRECATED \
            -ntb_opts uvm-1.2

RTL_FILES = $(wildcard ../rtl/*.sv)
TB_FILES  = tb_top.sv riscv_npu_if.sv \
            npu_agent/*.sv npu_env.sv npu_base_test.sv \
            tests/*.sv coverage/*.sv

compile:
	$(VCS) $(VCS_FLAGS) $(RTL_FILES) $(TB_FILES) -l comp.log -o simv

clean:
	rm -rf simv* csrc *.log *.vpd *.fsdb DVEfiles *.h urgReport
	
	
run_dotp:
	./simv +UVM_TESTNAME=npu_dotp_test \
	       +UVM_VERBOSITY=UVM_LOW \
	       -l run_dotp.log

run_random:
	./simv +UVM_TESTNAME=npu_random_test \
	       +UVM_VERBOSITY=UVM_MEDIUM \
	       -l run_random.log
		   
		   
wave_dotp:
	./simv +UVM_TESTNAME=npu_dotp_test \
	       -vpd wave_dotp.vpd \
	       -l wave.log
	verdi -vpd wave_dotp.vpd &
	
regression:
	@echo "=== Running Regression ==="
	./simv +UVM_TESTNAME=npu_dotp_test    -l reg_dotp.log
	./simv +UVM_TESTNAME=npu_random_test  -l reg_random.log
	./simv +UVM_TESTNAME=npu_stress_test  -l reg_stress.log
	@echo "=== All Tests Passed ==="
	
coverage:
	./simv +UVM_TESTNAME=npu_random_test \
	       -cm line+cond+fsm+branch+tgl \
	       -cm_dir cov_dir \
	       -cm_log cov.log \
	       -l cov_run.log

	urg -dir cov_dir.vdb -format both -report urg_report
	@echo "Coverage: urg_report/html/index.html"
	
